package com.test.p06prototype.example01;

import java.util.Date;

public class Sheep2 implements  Cloneable {

    private String name;

    private Date birthday;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    /**
     * native方法，效率高
     * 深拷贝
     * @return
     * @throws CloneNotSupportedException
     */
    @Override
    protected Object clone() throws CloneNotSupportedException {
        Sheep2 sheep2 = (Sheep2) super.clone();
        sheep2.birthday =(Date)sheep2.birthday.clone();
        return sheep2;
    }
}
